sfFocus = function() {
        $(':input:not(:hidden, :submit)')
            .each(function(index) {
              $(this).focus(function() {
                $(this).parent().addClass("highlight");
              });
              $(this).blur(function() {
                $(this).parent().removeClass("highlight");
              });
            });
}

sfDatetime = function() {
    $('.datetime')
        .each(function(index) {
            $(this).keypress(function(event) {
                console.info(event.which);
                if( !((event.which >= 47 && event.which <= 57) || event.which == 8  || event.which == 0 || event.which == 9)  ) {
                    return false;
                }
                if(this.value.length >= 10 && event.which != 8 && event.which != 0) {
                    return false;
                }
            });
        });
}

sfTime = function() {
    $('.time')
        .each(function(index) {
            $(this).keypress(function(event) {
                console.info(event.which);
                if( !((event.which >= 48 && event.which <= 57) || event.which == 58 || event.which == 8  || event.which == 0 || event.which == 9)  ) {
                    return false;
                }
                if(this.value.length >= 5 && event.which != 8 && event.which != 0) {
                    return false;
                }
            });
        });
}

$(document).ready(
    function() {
        sfFocus();
        sfDatetime();
        sfTime();
    }
);

